<%@page import="bibbletex.controllers.CollaborationController"%>
<jsp:useBean id="rc" class="bibbletex.models.RequestCollaboration"
	scope="page" />
<jsp:useBean id="sessiondata" class="bibbletex.models.SessionData"
	scope="session" />
<jsp:setProperty name="rc" property="*" />

<%@ page
	import="bibbletex.models.Collaboration,bibbletex.models.SessionData"%>

<%
	Collaboration c;
	if (request.getHeader("referer").contains("invite.jsp")){
		for(int i = 0; i < 10; i++)
			if(rc.emails[i] != null)
				CollaborationController.inviteEmail(sessiondata.collaboration, 
												sessiondata.collaboration.getEmail(), 
												rc.emails[i],
												rc.private_accesses[i]);
	}
	if (request.getHeader("referer").contains("edit.jsp"))
		c = new Collaboration(rc, sessiondata.collaboration.getId(), sessiondata.collaboration.getPublic_id());
	else {
		c = new Collaboration(rc);
		CollaborationController.inviteEmail(c);
	}

	sessiondata.collaboration = c;
	sessiondata.collaboration_is_editable = true;
%>

<jsp:forward page="show.jsp" />
